/**
 * 
 */
package com.juphoon.oauth.core.vaildate.code;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;


/**
 * 验证码信息封装类
 * 
 * @author zhailiang
 *
 */
@Data
@AllArgsConstructor
public class ValidateCode implements Serializable {

	private static final long serialVersionUID = 1588203828504660915L;

	private String code;
	
	private LocalDateTime expireTime;
	
	public ValidateCode(String code, int expireIn){
		this.code = code;
		this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
	}
	
	public boolean isExpried() {
		return LocalDateTime.now().isAfter(expireTime);
	}


	public ValidateCode(){}

	
}
